﻿// The Nova Project by Ken Beckett.
// Copyright (C) 2007-2012 Inevitable Software, all rights reserved.
// Released under the Common Development and Distribution License, CDDL-1.0: http://opensource.org/licenses/cddl1.php

using System.Collections.Generic;

using Nova.CodeDOM;

namespace Nova.UI
{
    /// <summary>
    /// The view model for a <see cref="CodeDOM.ConstructorInitializer"/>.
    /// </summary>
    public abstract class ConstructorInitializerVM : CallVM
    {
        #region /* CONSTRUCTORS */

        /// <summary>
        /// Create a view model instance for the specified <see cref="CodeDOM.ConstructorInitializer"/>.
        /// </summary>
        protected ConstructorInitializerVM(ConstructorInitializer constructorInitializer, Dictionary<CodeObject, CodeObjectVM> dictionary)
            : base(constructorInitializer, dictionary)
        { }

        #endregion

        #region /* PROPERTIES */

        /// <summary>
        /// The underlying <see cref="CodeDOM.ConstructorInitializer"/> model.
        /// </summary>
        public ConstructorInitializer ConstructorInitializer
        {
            get { return (ConstructorInitializer)CodeObject; }
        }

        #endregion

        #region /* METHODS */

        #endregion

        #region /* RENDERING */

        protected override void RenderName(CodeRenderer renderer, RenderFlags flags)
        {
            renderer.RenderText(ConstructorInitializer.Symbol, _expressionVM.GetMessageBrush(KEYWORD_BRUSH, flags), this);
        }

        public override void RenderExpression(CodeRenderer renderer, RenderFlags flags)
        {
            renderer.RenderText(ConstructorInitializer.ParseTokenInitializer + " ", PUNC_BRUSH, ParentVM);
            base.RenderExpression(renderer, flags);
        }

        public override void RenderToolTip(CodeRenderer renderer, RenderFlags flags)
        {
            TypeRefBaseVM.RenderType(renderer, CodeObject.GetType(), flags, this);
            renderer.RenderText(": ", IDENTIFIER_BRUSH, this);
            CreateVM(ArgumentsOperator.Expression).RenderToolTip(renderer, flags);
        }

        #endregion
    }
}
